<template>
    <div>
        <com-heard></com-heard>
        <div class="cons">
            <div class="cons-1 pu-con">
                <router-link :to="{path:'/details',query:{id:curNews1.id,type:4}}">
                    <img v-if="curNews1.url" :src="prefixUrl+curNews1.url" alt />
                    <p v-text="curNews1.title"></p>
                </router-link>
                <div>
                    <router-link
                        :to="{path:'/details',query:{id:item.id,type:4}}"
                        v-for="(item,index) in curNews2"
                        :key="index"
                    >
                        <p v-text="item.title"></p>
                    </router-link>
                </div>
            </div>
            <div class="cons-2 pu-con">
                <img :src="newsImg1" alt />
                <span>
                    <p
                        @mouseenter="enter(item,index)"
                        @mouseleave="leave()"
                        v-for="(item,index) in curNews3"
                        :key="item.id"
                        :class="curindex1===index?'news1-on':''"
                    >
                        <router-link
                            :to="{path:'/details',query:{id:item.id,type:5}}"
                        >{{ item.title }}</router-link>
                    </p>
                </span>
            </div>
            <div class="cons-3 pu-con">
                <p>
                    <img src="../../assets/6.png" alt />
                    <strong>江苏省广告协会</strong>
                </p>
                <marquee-left :sendVal="curNews4"></marquee-left>
                <router-link :to="{path:'/jsgg/hyzixun',query:{type:1}}">更多+</router-link>
            </div>
            <div class="cons-4 pu-con">
                <div class="cons-41">
                    <div class="cons-411">
                        <p>
                            <strong>热点</strong>
                            <strong>解读</strong>
                        </p>

                        <div class="c-411-lun">
                            <el-carousel height="270px" indicator-position="none">
                                <el-carousel-item v-for="(item,index) in curNews8" :key="index">
                                    <router-link :to="{path:'/details',query:{id:item.id,type:7}}">
                                        <img :src="prefixUrl+item.coverImageUrl" alt />
                                        <p v-text="item.title"></p>
                                    </router-link>
                                </el-carousel-item>
                            </el-carousel>
                        </div>
                    </div>
                    <div class="cons-412">
                        <span class="pu-title">
                            <h1>人物专访</h1>
                            <router-link :to="{path:'/news/list',query:{type:0}}">更多+</router-link>
                        </span>
                        <div class="c-412-news">
                            <router-link
                                v-for="(item,index) in curNews7"
                                :key="index"
                                :to="{path:'/details',query:{id:item.id,type:0}}"
                            >{{item.title}}</router-link>
                        </div>
                    </div>
                    <div class="cons-413">
                        <a v-if="curNews9.length>0" :href="curNews9[0].linkUrl" target="_bank">
                            <img :src="prefixUrl+curNews9[0].imageUrl" alt />
                        </a>
                    </div>
                </div>
                <div class="cons-42">
                    <div class="keji">
                        <router-link
                            :to="{path:'/details',query:{id:item.id,type:7}}"
                            v-for="(item,index) in curNews5"
                            :key="index"
                            v-text="item.title"
                        ></router-link>
                    </div>
                </div>
                <div class="cons-43">
                    <span class="pu-title">
                        <h1>活动会展</h1>
                        <router-link :to="{path:'/news/list',query:{type:1}}">更多+</router-link>
                    </span>
                    <div class="cons-431">
                        <router-link
                            v-for="(item,index) in curNews6.slice(0,1)"
                            :key="index"
                            :to="{path:'/details',query:{id:item.id,type:1}}"
                        >
                            <img :src="prefixUrl+item.coverImageUrl" alt />
                            <p v-text="item.title"></p>
                        </router-link>
                        <span>
                            <router-link
                                v-for="(item,index) in curNews6.slice(1)"
                                :key="index"
                                :to="{path:'/details',query:{id:item.id,type:1}}"
                            >
                                <img :src="prefixUrl+item.coverImageUrl" alt />
                                <p v-text="item.title"></p>
                            </router-link>
                        </span>
                    </div>
                </div>
            </div>
            <div class="cons-5 pu-con">
                <a v-if="curNews9.length>0" :href="curNews9[1].linkUrl" target="_bank">
                    <img :src="prefixUrl+curNews9[1].imageUrl" alt />
                </a>
                <a v-if="curNews9.length>0" :href="curNews9[2].linkUrl" target="_bank">
                    <img :src="prefixUrl+curNews9[2].imageUrl" alt />
                </a>
            </div>
            <div class="cons-6 pu-con">
                <div class="cons-61">
                    <span class="pu-title">
                        <h1>法律法规</h1>
                        <a href="JavaScript:;">广告法律法规 / 新广告法解读 / 地方性广告法</a>
                    </span>
                    <div
                        class="cons-42 flvfg"
                        style="width:400px;padding:0 15px;	box-sizing: border-box;"
                    >
                        <div>
                            <router-link
                                :to="{path:'/details',query:{id:item.id,type:6}}"
                                v-for="(item,index) in curNews10"
                                :key="index"
                                v-text="item.title"
                            ></router-link>
                        </div>
                    </div>
                </div>
                <div class="cons-62">
                    <span class="pu-title">
                        <h1>案例解析</h1>
                        <router-link :to="{path:'/news/list',query:{type:2}}">更多+</router-link>
                    </span>
                    <div class="con-62-1">
                        <router-link
                            :to="{path:'/details',query:{id:item.id,type:2}}"
                            v-for="(item,index) in curNews11.slice(0,1)"
                            :key="index"
                        >
                            <img :src="prefixUrl+item.coverImg" alt />
                            <p v-text="item.name"></p>
                        </router-link>
                        <div class="con-62-lun">
                            <router-link
                                :to="{path:'/details',query:{id:item.id,type:2}}"
                                v-for="(item,index) in curNews11.slice(1,5)"
                                :key="index"
                            >
                                <img :src="prefixUrl+item.coverImg" alt />
                                <p v-text="item.name"></p>
                            </router-link>
                        </div>
                    </div>
                </div>
                <div class="cons-83">
                    <span class="pu-title">
                        <h1>人才招聘</h1>
                    </span>
                    <a href="http://www.cain086.com:8099/" target="_blank">
                        <img src="../../assets/23.png" alt />
                    </a>
                    <a href="http://www.cain086.com:8099/" target="_blank">
                        <img src="../../assets/24.png" alt />
                    </a>
                    <router-link to>
                        <span>
                            <h1>高质量岗位 数万家企业</h1>
                            <p>
                                上大苏职达车，
                                <br />让你“职”达人生巅峰
                            </p>
                        </span>
                        <span>
                            <img src="../../assets/28.png" alt />
                        </span>
                    </router-link>
                </div>
            </div>
            <div class="cons-5 pu-con" style="margin:20px auto 0">
                <a v-if="curNews9.length>0" :href="curNews9[4].linkUrl" target="_bank">
                    <img :src="prefixUrl+curNews9[4].imageUrl" alt />
                </a>
                <a v-if="curNews9.length>0" :href="curNews9[5].linkUrl" target="_bank">
                    <img :src="prefixUrl+curNews9[5].imageUrl" alt />
                </a>
            </div>
        </div>
        <com-foot></com-foot>
    </div>
</template>

<script>
import jwt_decode from "jwt-decode";
import { getToken } from '@/utils/auth'
import comHeard from '@/components/com-heard'
import comFoot from '@/components/com-foot'
import marqueeLeft from '@/components/marquee'
export default {
    components: {
        comHeard,
        comFoot,
        marqueeLeft
    },
    data() {
        return {
            prefixUrl: '',
            curNews1: {},
            curNews2: [],
            newsImg1: '',
            curindex1: 0,
            curNews3: [],
            curNews4: [],
            curNews5: [],
            curNews6: [],
            curNews7: [],
            curNews8: [],
            curNews9: [],
            curNews10: [],
            curNews11: [],
            curNews12: [],
            curNews13: [],
            curNews14: [],

            contra: '',
            fotShow: 0
        }
    },
    created() {
        // this.getInfo()
        this.getIndexArticTitle() 	//获取标题新闻
        this.getIndexAuthority()  	//获取权威
        this.getIndexHotspot()  	//热点解读
        this.getIndexShaky()  		//活动会展
        this.getIndexFigure()  		//人物专访
        this.getIndexRdjdImage() 	//热点解读的轮播
        this.getIndexListbyIndex() 	//广告位
        this.getIndexFalvfagui()	//法律法规
        this.getIndexAnjianjiedu()	//案例解析
        this.getIndexWeijinList()	//违禁词列表
        this.getIndexJiangxiangList()	//奖项类别
        this.getIndexGongxuzhida()	//供需直达
        this.getIndustryInfo()
    },
    mounted() {
        this.prefixUrl = this.$store.state.user.imgUrl
    },
    methods: {
        enter(data, index) {
            this.curindex1 = index
            this.newsImg1 = this.prefixUrl + data.coverImageUrl
        },
        leave() { },
        async getIndustryInfo() {
            var data = { currentPage: 1, pageSize: 10, menuName: "通知公告" }
            const res = await this.$store.dispatch('news/getIndustryInfo', data)
            this.curNews4 = res.list
        },
        async getIndexArticTitle() {
            const res = await this.$store.dispatch('news/getIndexArticTitle')
            this.curNews1 = res.main;
            this.curNews2 = res.subTitleList.slice(0, 3)
        },
        async getIndexAuthority() {
            var data = { currentPage: 1, pageSize: 10, code: "hyzx_qwzx" }
            const res = await this.$store.dispatch('news/getIndexAuthority', data)
            this.curNews3 = res.data.slice(0, 6)
            this.newsImg1 = this.prefixUrl + this.curNews3[0].coverImageUrl

        },
        async getIndexHotspot() {
            var data = { currentPage: 1, pageSize: 20, code: "hyzx_rdjd" }
            const res = await this.$store.dispatch('news/getIndexAuthority', data)
            this.curNews5 = res.data
        },
        async getIndexShaky() {
            var data = { currentPage: 1, pageSize: 4, code: "hyzx_hdzh" }
            const res = await this.$store.dispatch('news/getIndexAuthority', data)
            this.curNews6 = res.data
        },
        async getIndexFigure() {
            var data = { currentPage: 1, pageSize: 6, code: "hyzx_rwzf" }
            const res = await this.$store.dispatch('news/getIndexAuthority', data)
            this.curNews7 = res.data
        },
        async getIndexRdjdImage() {
            var data = { currentPage: 1, pageSize: 5, code: "hyzx_rwzf" }
            const res = await this.$store.dispatch('news/getIndexRdjdImage', data)
            this.curNews8 = res.data
        },
        async getIndexListbyIndex() {
            const res = await this.$store.dispatch('news/getIndexListbyIndex')
            this.curNews9 = res
        },
        async getIndexFalvfagui() {
            var data = { currentPage: 1, pageSize: 14 }
            const res = await this.$store.dispatch('news/getIndexFalvfagui', data)
            this.curNews10 = res.data
        },
        async getIndexAnjianjiedu() {
            var data = { currentPage: 1, pageSize: 5 }
            const res = await this.$store.dispatch('news/getIndexAnjianjiedu', data)
            this.curNews11 = res.data
        },
        async getIndexWeijinList() {
            const res = await this.$store.dispatch('news/getIndexWeijinList')
            this.curNews12 = res
        },
        async getIndexJiangxiangList() {
            var data = { currentPage: 1, pageSize: 5 }
            const res = await this.$store.dispatch('news/getIndexJiangxiangList', data)
            this.curNews13 = res.data
        },
        async getIndexJiangxiangList() {
            var data = { currentPage: 1, pageSize: 5 }
            const res = await this.$store.dispatch('news/getIndexJiangxiangList', data)
            this.curNews13 = res.data
        },
        async getIndexGongxuzhida() {
            var data = { currentPage: 1, pageSize: 10, code: "hyzx_gxzd" }
            const res = await this.$store.dispatch('news/getIndexAuthority', data)
            this.curNews14 = res.data
        },
        uncultivated() {
            this.$message({
                message: '功能暂未开放，敬请期待',
                type: 'warning'
            });
        }
        // async getInfo() {
        //     const user = jwt_decode(getToken())
        //     const res = await this.$store.dispatch('user/getInfoList')
        //     console.log(res)
        // }
    }
}
</script>

<style scoped>
@import "./home.css";
</style>